package hanhns.test;

import hanhns.test.R;
import hanhns.test.listview.ListNote;
import hanhns.test.listview.ListNoteUseSimpleCursorAdapter;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class SignInActivity extends Activity implements OnClickListener{
	Button signIn;
	TextView uname;
	TextView password;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sign_in);
        signIn = (Button) findViewById(R.id.buttonSignIn);
        uname = (TextView) findViewById(R.id.uname);
        password = (TextView) findViewById(R.id.password); 
//        signIn = new Button(this);
        signIn.setOnClickListener(this);
    }

	@Override
	public void onClick(View arg0) {
		
		// TODO Auto-generated method stub
		 TextView helloText = new TextView(this);
	     helloText.setText("Hello. Is My apps");
		if(arg0.getId() == R.id.buttonSignIn){
//			Intent list = new Intent(this, ListNote.class);//use ArayAdapter
			if((uname.getText().toString()).equals(password.getText().toString())){
				//use SimpleCusorAdapter
				Intent list = new Intent(this, ListNoteUseSimpleCursorAdapter.class);
				this.startActivity(list);
			}
			else{
				
				Intent i = new Intent(getApplicationContext(), hanhns.test.GetNews.class);
				this.startActivity(i);
			}
			
		}
	}
}